﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CinemaDbLib;
using ModelLayer;

public class Auth
{
    private static UserCtrl localUserCtrl;
	public static bool login(string username, string password)
	{
        if (localUserCtrl == null) localUserCtrl = new UserCtrl();
        User user = localUserCtrl.getUser(username);
		if (user == null)
			return false;
        return user.password == password;
	}

	public static bool register(string username, string email, string password)
	{
        if (localUserCtrl == null) localUserCtrl = new UserCtrl();
        return localUserCtrl.addUser(username, email, password) > -1;
	}
}